package com.infinitus.nginxInfo.task;




import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.infinitus.nginxInfo.config.KafkaConfig;

/**
 * 
 * kafka消息清洗模块启动器
 *
 */
@Component
public class Start {
	@Autowired
	public Cleaner cleaner;
	
	@Autowired
	private LoadDataTask loadDataTask;
	
	@Autowired
	private KafkaConfig kafkaConfig;
	
	
	public  Start( ) {
	
	}
	 
//	@PostConstruct
	public void hand() throws InterruptedException {
		System.out.println("初始化成功");
	}
	

	@PostConstruct
	public void initialize() throws InterruptedException {
		//初始化静态内存
		loadDataTask.loadTopicTokens();
		loadDataTask.loadFieldTypes();
		
		System.out.println("...............启动kafka消息清洗模块................");
		
		cleaner.clean(kafkaConfig.getDirtyNginxTopic(), kafkaConfig.getCleanNginxTopic());
		cleaner.clean(kafkaConfig.getDirtySwitchTopic(), kafkaConfig.getCleanSwitchTopic());
	}

}
